package com.itheima.service;

import com.itheima.dao.UserMapper;
import com.itheima.pojo.User;
import com.itheima.util.SessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

public class UserService {

    /**
     * 功能: 查询所有用户将所有数据返回给web层
     * @return 用户集合
     */
    public List<User> findAllUser(){
        //获取会话对象
        SqlSession sqlSession = SessionFactoryUtils.getSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);
        //返回用户集合
        return userMapper.findAllUser();

    }
}
